// run: $exec < input
#include <iostream>
#include <algorithm>

int const maxn = 100007;
int a[maxn];
int sum[maxn];

int main()
{
	std::ios::sync_with_stdio(false);
	int T; std::cin >> T;
	while (T--) {
		int n;
		std::cin >> n;
		for (int i = 0; i < n; i++) std::cin >> a[i];
		sum[n] = 0;
		for (int i = n - 1; i >= 0; i--)
			sum[i] = sum[i + 1] + (a[i] > 0);
		int max = 0;
		for (int i = 0; i < n; i++)
			max = std::max(max, a[i] + sum[i + 1]);
		std::cout << max << '\n';
	}
}

